<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
  </head>
  <body>
    <div id="app">
      <h1 v-bind:title="msg">{{msg}}</h1>
      <p v-if="seen">条件为真就可以看见</p>
      <!-- <ul>
          <li>{{friends[0]}}</li>
          <li>{{friends[1]}}</li>
          <li>{{friends[2]}}</li>
      </ul> -->
      <ul>
        <li v-for="f in friends">{{f}}</li>
      </ul>
      <!-- v-for="x in xs" -->

      <ol>
          <li v-for="todo in todos">{{todo.text}}</li>
      </ol>
    </div>
    <!-- 模板内部不需要 加app -->
    <script>
      var app = new Vue({
        el: "#app",
        data: {
          msg: "hello vue",
          seen: true,
          friends: ["小红", "小花", "小翠"],
          todos: [
            { text: "学习 JavaScript" },
            { text: "学习 Vue" },
            { text: "整个牛项目" },
          ],
        },
      });

      console.log(app.msg);

      app.friends.push("大都");
    </script>
  </body>
</html>
